package com.wsn.mongodb.mongodbdemo.controller;

import com.wsn.mongodb.mongodbdemo.entity.User;
import com.wsn.mongodb.mongodbdemo.service.TestService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.jws.soap.SOAPBinding;
import java.util.List;

/**
 * @Description: 测试接口
 * @ClassName: TestController
 * @Author: weisn
 * @Date: 2022/5/20 15:55
 * @Version: 1.0
 */
@RestController
@RequestMapping(value = "api/test")
public class TestController {
    @Autowired
    private TestService testService;

    @GetMapping(value = "getById")
    public User getUserById(Integer userId) {
        return testService.getUserById(userId);
    }

    @GetMapping(value = "getList")
    public List<User> getUserList(User user) {
        return testService.getUserList(user);
    }

    @PostMapping(value = "add")
    public Object addUser(@RequestBody Object user) {
        return testService.addUser(user);
    }

    @PostMapping(value = "del")
    public Long delUser(@RequestBody User user) {
        return testService.delUser(user);
    }
}
